<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Elasticsearch集群高可用性配置指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        .section-title {
            position: relative;
            padding-left: 20px;
        }
        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 30px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .drop-cap {
            float: left;
            font-size: 4em;
            line-height: 0.8;
            margin: 0.1em 0.1em 0 0;
            font-weight: 700;
            color: #667eea;
        }
        .mermaid {
            background: white;
            padding: 20px;
            border-radius: 10px;
        }
        .highlight-box {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 20px;
            border-radius: 10px;
            margin: 20px 0;
        }
        .tech-badge {
            background: rgba(102, 126, 234, 0.1);
            color: #667eea;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 0.875rem;
            display: inline-block;
            margin: 4px;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto text-center">
                <h1 class="text-5xl md:text-6xl font-bold mb-6 leading-tight">
                    <i class="fas fa-server mr-4"></i>
                    Elasticsearch集群高可用性配置指南
                </h1>
                <p class="text-xl md:text-2xl mb-8 opacity-90">
                    构建永不停机的分布式搜索引擎架构
                </p>
                <div class="flex flex-wrap justify-center gap-4">
                    <span class="tech-badge bg-white bg-opacity-20 text-white">
                        <i class="fas fa-shield-alt mr-2"></i>高可用性
                    </span>
                    <span class="tech-badge bg-white bg-opacity-20 text-white">
                        <i class="fas fa-network-wired mr-2"></i>分布式架构
                    </span>
                    <span class="tech-badge bg-white bg-opacity-20 text-white">
                        <i class="fas fa-database mr-2"></i>数据冗余
                    </span>
                </div>
            </div>
        </div>
    </section>

    <!-- Introduction -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto">
                <p class="text-lg leading-relaxed text-gray-700">
                    <span class="drop-cap">在</span>现代分布式系统中，高可用性（High Availability, HA）已经成为一个不可或缺的设计目标。对于一个依赖于实时搜索和数据分析的企业来说，Elasticsearch（ES）是一个至关重要的组件，它不仅支持复杂的数据查询，还能实时处理大规模的数据。
                </p>
                <div class="highlight-box mt-8">
                    <p class="text-lg">
                        <i class="fas fa-exclamation-triangle mr-2"></i>
                        如果Elasticsearch集群出现问题，比如节点故障或者数据丢失，可能会导致整个系统的服务中断，甚至带来不可估量的损失。
                    </p>
                </div>
            </div>
        </div>
    </section>

    <!-- 高可用的重要性 -->
    <section class="py-16 bg-gray-50">
        <div class="container mx-auto px-6">
            <div class="max-w-6xl mx-auto">
                <h2 class="text-4xl font-bold mb-12 text-center section-title">
                    <i class="fas fa-heartbeat mr-3 text-purple-600"></i>高可用的重要性
                </h2>
                
                <div class="grid md:grid-cols-2 gap-8">
                    <div class="card-hover bg-white p-8 rounded-lg shadow-lg">
                        <div class="flex items-center mb-4">
                            <div class="w-12 h-12 bg-purple-100 rounded-full flex items-center justify-center mr-4">
                                <i class="fas fa-server text-purple-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-semibold">系统稳定性</h3>
                        </div>
                        <p class="text-gray-700 leading-relaxed">
                            高可用性确保系统在出现硬件故障、网络中断、软件错误等问题时，依然能够保持稳定运行。通过冗余和容错机制，即使部分组件失效，系统仍能继续提供服务。
                        </p>
                    </div>
                    
                    <div class="card-hover bg-white p-8 rounded-lg shadow-lg">
                        <div class="flex items-center mb-4">
                            <div class="w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mr-4">
                                <i class="fas fa-shield-alt text-blue-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-semibold">数据安全</h3>
                        </div>
                        <p class="text-gray-700 leading-relaxed">
                            通过冗余存储和数据复制策略，确保在单点故障时数据不会丢失。数据可以被分片并复制到多个节点上，当一个节点失效时，系统可以自动切换到另一个包含相同数据的节点。
                        </p>
                    </div>
                    
                    <div class="card-hover bg-white p-8 rounded-lg shadow-lg">
                        <div class="flex items-center mb-4">
                            <div class="w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mr-4">
                                <i class="fas fa-cogs text-green-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-semibold">设计挑战</h3>
                        </div>
                        <p class="text-gray-700 leading-relaxed">
                            实现高可用性需要克服系统复杂性增加、成本上升、性能潜在影响等挑战。需要在冗余与性能、成本之间找到平衡。
                        </p>
                    </div>
                    
                    <div class="card-hover bg-white p-8 rounded-lg shadow-lg">
                        <div class="flex items-center mb-4">
                            <div class="w-12 h-12 bg-yellow-100 rounded-full flex items-center justify-center mr-4">
                                <i class="fas fa-business-time text-yellow-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-semibold">业务连续性</h3>
                        </div>
                        <p class="text-gray-700 leading-relaxed">
                            对于金融、医疗、电子商务等领域，系统需要24/7无间断服务。高可用性架构确保业务操作的连续性，避免系统不可用导致的业务中断。
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- ES集群架构概述 -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-6">
            <div class="max-w-6xl mx-auto">
                <h2 class="text-4xl font-bold mb-12 text-center section-title">
                    <i class="fas fa-sitemap mr-3 text-purple-600"></i>ES集群架构概述
                </h2>
                
                <div class="mb-12">
                    <div class="mermaid">
                        graph TB
                            subgraph "Elasticsearch Cluster"
                                M1[Master Node 1<br/>主节点1]
                                M2[Master Node 2<br/>主节点2]
                                M3[Master Node 3<br/>主节点3]
                                
                                D1[Data Node 1<br/>数据节点1]
                                D2[Data Node 2<br/>数据节点2]
                                D3[Data Node 3<br/>数据节点3]
                                D4[Data Node 4<br/>数据节点4]
                                
                                C1[Coordinating Node<br/>协调节点]
                                
                                I1[Ingest Node<br/>索引节点]
                            end
                            
                            Client[客户端应用] --> C1
                            C1 --> D1
                            C1 --> D2
                            C1 --> D3
                            C1 --> D4
                            
                            M1 -.-> M2
                            M2 -.-> M3
                            M3 -.-> M1
                            
                            style M1 fill:#f9f,stroke:#333,stroke-width:2px
                            style M2 fill:#f9f,stroke:#333,stroke-width:2px
                            style M3 fill:#f9f,stroke:#333,stroke-width:2px
                            style D1 fill:#9cf,stroke:#333,stroke-width:2px
                            style D2 fill:#9cf,stroke:#333,stroke-width:2px
                            style D3 fill:#9cf,stroke:#333,stroke-width:2px
                            style D4 fill:#9cf,stroke:#333,stroke-width:2px
                            style C1 fill:#fcf,stroke:#333,stroke-width:2px
                            style I1 fill:#cfc,stroke:#333,stroke-width:2px
                    </div>
                </div>
                
                <div class="grid md:grid-cols-3 gap-6 mt-12">
                    <div class="bg-purple-50 p-6 rounded-lg">
                        <h3 class="text-xl font-semibold mb-3 text-purple-800">
                            <i class="fas fa-crown mr-2"></i>主节点 (Master Node)
                        </h3>
                        <p class="text-gray-700">负责管理集群元数据和索引状态，包括节点的加入或离开、索引的创建和删除、分片的分配等。</p>
                    </div>
                    
                    <div class="bg-blue-50 p-6 rounded-lg">
                        <h3 class="text-xl font-semibold mb-3 text-blue-800">
                            <i class="fas fa-database mr-2"></i>数据节点 (Data Node)
                        </h3>
                        <p class="text-gray-700">存储数据并执行CRUD操作，以及聚合等数据相关任务。通过分片机制实现数据分布式存储。</p>
                    </div>
                    
                    <div class="bg-pink-50 p-6 rounded-lg">
                        <h3 class="text-xl font-semibold mb-3 text-pink-800">
                            <i class="fas fa-route mr-2"></i>协调节点 (Coordinating Node)
                        </h3>
                        <p class="text-gray-700">处理客户端请求，将搜索和索引请求转发给相关节点，并在返回结果前进行数据合并。</p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- 配置多主节点 -->
    <section class="py-16 bg-gray-50">
        <div class="container mx-auto px-6">
            <div class="max-w-6xl mx-auto">
                <h2 class="text-4xl font-bold mb-12 text-center section-title">
                    <i class="fas fa-users-cog mr-3 text-purple-600"></i>配置多主节点以避免单点故障
                </h2>
                
                <div class="bg-white rounded-lg shadow-lg p-8 mb-8">
                    <h3 class="text-2xl font-semibold mb-6">配置步骤</h3>
                    
                    <div class="space-y-6">
                        <div class="flex items-start">
                            <div class="flex-shrink-0 w-10 h-10 bg-purple-600 text-white rounded-full flex items-center justify-center font-bold">1</div>
                            <div class="ml-4">
                                <h4 class="text-lg font-